﻿Imports System.Data.SqlClient
Public Class FormCategory
    Private Sub loaddata()
        Cmd.Parameters("@S") = "%" & txtSearch.Text & "%"
        Me.DataGridView1.DataSource = Cmd.ExecuteDataTable("select CategoryName,TypeName from Category C inner join [Type] T on T.TypeId = C.TypeId where upper(CategoryName) like upper(@S) and C.Active=1")
    End Sub
    Private Sub FormStore_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        UI.FormatDataGrid(Me.DataGridView1)
        loaddata()
    End Sub

    Private Sub txtSearch_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSearch.TextChanged
        loaddata()
    End Sub

    Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
        FormCategoryEditor.ShowDialog()
    End Sub
End Class
